package com.cy.zs.hp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cy.zs.hp.mapper.HisRegisterMapper;
import com.cy.zs.hp.model.HisRegister;
import com.cy.zs.hp.service.IHisRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 该表处理预约登记 服务实现类
 * </p>
 *
 * @author cgb2008
 * @since 2020-11-28
 */
@Service
public class HisRegisterServiceImpl extends ServiceImpl<HisRegisterMapper, HisRegister> implements IHisRegisterService {
    @Autowired
    private HisRegisterMapper hisRegisterMapper;

    @Override
    public List<HisRegister> findRegister(String username) {
        return hisRegisterMapper.findRegister(username);
    }

    @Override
    public int insertRegister(HisRegister hisRegister) {
        return hisRegisterMapper.insertRegister(hisRegister);
    }

    @Override
    public List<HisRegister> findByDoctorId(Integer id,Integer pId) {
        QueryWrapper<HisRegister> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("doctor_id",id);
        queryWrapper.in("patient_id", pId);
        List<HisRegister> registerList = hisRegisterMapper.selectList(queryWrapper);
        return registerList;
    }
}
